package com.fan.leetcode;

import java.util.Arrays;

/**
 * 1877. 数组中最大数对和的最小值
 *
 * @author ZhangFan
 * @since 2021/7/20 下午 9:06
 */
public class Question1877 {
    public int minPairSum(int[] nums) {
        Arrays.sort(nums);
        int max = 0;
        for (int i = 0, j = nums.length - 1; i < nums.length/2; i++,j--) {
            int temp = nums[i] + nums[j];
            if (temp > max) {
                max = temp;
            }
        }
        return max;
    }
}
